/** 数据操作：同步函数 */
import {
  COUNTER_INCREMENT,
  COUNTER_DECREMENT
} from './counterType'


function counterReducer(state = 0, actionCreator) {
  switch (actionCreator.type) {

    case COUNTER_INCREMENT:

      state += actionCreator.data
      console.log("增加数据", state)
      return state

    case COUNTER_DECREMENT:

      state -= actionCreator.data
      console.log("减少数据", state)
      return state

    default:
      console.log("读取数据", state)
      return state

  }
}

export default counterReducer
